project(rtc-base)

file(GLOB rtc_base_sources
        ${CMAKE_CURRENT_SOURCE_DIR}/*.cc
        ${CMAKE_CURRENT_SOURCE_DIR}/*.h
        ${CMAKE_CURRENT_SOURCE_DIR}/*/*.cc
        ${CMAKE_CURRENT_SOURCE_DIR}/*/*.h)

add_library( ${PROJECT_NAME} ${LIB_TYPE} ${rtc_base_sources})

#find_package(absl CONFIG REQUIRED)
#if (absl_FOUND)
target_link_libraries(${PROJECT_NAME} PUBLIC absl::base
        absl::bad_optional_access
        absl::city
        absl::flags_commandlineflag
        absl::flags_commandlineflag_internal
        absl::flags_config
        absl::flags_internal
        absl::flags_marshalling
        absl::flags_parse
        absl::flags_private_handle_accessor
        absl::flags_program_name
        absl::flags_reflection
        absl::flags_usage
        absl::flags_usage_internal
        absl::hash
        absl::int128
        absl::malloc_internal
        absl::raw_logging_internal
        absl::spinlock_wait
        absl::stacktrace
        absl::str_format_internal
        absl::strings
        absl::symbolize
        absl::synchronization
        absl::throw_delegate
        absl::time
        absl::time_zone)
#endif ()

target_compile_definitions(${PROJECT_NAME} PUBLIC WEBRTC_LIBRARY_IMPL WEBRTC_ENABLE_SYMBOL_EXPORT)

if (WIN32)
    target_compile_definitions(${PROJECT_NAME} PUBLIC NOMINMAX WEBRTC_WIN _WIN32 WIN32_LEAN_AND_MEAN)
elseif(ANDROID)
    target_compile_definitions(${PROJECT_NAME} PUBLIC WEBRTC_ANDROID WEBRTC_LINUX)
elseif (NOT ANDROID AND NOT IOS)
    target_compile_definitions(${PROJECT_NAME} PUBLIC WEBRTC_LINUX WEBRTC_THREAD_RR WEBRTC_POSIX)
endif ()